package service;

import dao.*;
import model.*;
import util.*;

 public class LoginService{
	 private static LoginService loginService=new LoginService();
	 private LoginService() {}
	 public static LoginService getInstance() {
		 return loginService;
	 }
	 private UserDao userDao=UserDao.getInstance();
	 private AdminDao adminDao=AdminDao.getInstance();
	 private RemindService remindService=RemindService.getInstance();
	 public User userLogin(int uid,String password) {
		User u= userDao.queryUser(uid, password);
		if(u!=null) {
			String remind=remindService.getRemindByUid(uid);
			if(remind!=null&& !remind.equals(""))//前者判断是否是否指向某字符串，后者判断是否为空
			ShowMessage.show("您预约的"+remind+"已经可以办理入住了！\n赶紧去看看吧！");
		}
		return u;
		 
	 }
	 
	 
	 public Admin adminLogin(int id, String password) {
	        return adminDao.queryAdmin(id, password);
	    }
 }